/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uni.lpoo.tool;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author lucero
 */
public class Conexion {
  private String driver;
  private String url;
  private String user;
  private String pass;
   
  public Conexion(String driver, String url , String user, String pass) throws Exception{
  this.driver=driver;
  this.url=url;
  this.user=user;
  this.pass=pass;
  //Cargar driver
  Class.forName(driver).newInstance();  
  }
  
  //Obtiene y retorna  la conexion
  public Connection getConnectionX(){
  Connection cnn=null;
        try {
            cnn = DriverManager.getConnection(url, user, pass);
        } catch (SQLException ex) {
            ex.printStackTrace();
           
           // Logger.getLogger(Conexion.class.getName()).log(Level.SEVERE, null, ex);
        }
      
  return cnn;
  }    
  
  
    public String getDriver() {
        return driver;
    }

    public void setDriver(String driver) {
        this.driver = driver;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }
    
  
    
}
